package com.qingcheng.controller.comment;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.entity.PageResult;
import com.qingcheng.entity.Result;
import com.qingcheng.pojo.comment.AdminComment;
import com.qingcheng.service.comment.AdminCommentService;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/adminComment")
public class AdminCommentControllerht {

    @Reference
    private AdminCommentService adminCommentService;

    @GetMapping("/findAll")
    public List<AdminComment> findAll(){
        return adminCommentService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<AdminComment> findPage(int page, int size){
        return adminCommentService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<AdminComment> findList(@RequestBody Map<String,Object> searchMap){
        return adminCommentService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<AdminComment> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  adminCommentService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public AdminComment findById(String id){
        return adminCommentService.findById(id);
    }



    @PostMapping("/add")
    public Result add(@RequestBody AdminComment adminComment){
        adminCommentService.add(adminComment);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody AdminComment adminComment){
        adminCommentService.update(adminComment);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(String id){
        adminCommentService.delete(id);
        return new Result();
    }

    /**
     * 保存客服回复
     * @param adminComment
     * @return
     */
    @PostMapping("/save")
    public Result save(@RequestBody AdminComment adminComment){
        adminCommentService.save(adminComment);
        return new Result();
    }
}
